package com.kelvin.oocl.crm.db;

import com.kelvin.oocl.crm.entity.Customer;
import com.kelvin.oocl.crm.util.MyLinkList;

public class DBDataStorage {
	private static MyLinkList<Customer> customers;
	private static int idIncrement =1;
	
	private DBDataStorage() {
	}
	
	public static MyLinkList<Customer> asscessData(){
		if(customers==null){
			synchronized (DBDataStorage.class) {
				if(customers==null){
					customers = new MyLinkList<>();
					initData();
				}
			}
		}
		return customers;
	}
	
	public static int getIncrementor(){
		return idIncrement;
	}
	
	public static void initData(){
		Customer c10 = new Customer(idIncrement++, "Kelvin", "male", "1994-06-01", "Software_Road_001", "1372222000");
		Customer c1 = new Customer(idIncrement++, "Mike", "male", "1995-07-03", "Software_Road_002", "1372222001");
		Customer c2 = new Customer(idIncrement++, "Nick", "male", "1995-06-04", "Software_Road_003", "1372222002");
		Customer c3 = new Customer(idIncrement++, "Lisa", "female", "1995-06-03", "Software_Road_004", "1372222003");
		Customer c4 = new Customer(idIncrement++, "Allen", "female", "1995-06-09", "Software_Road_005", "1372222004");
		Customer c5 = new Customer(idIncrement++, "Barry", "male", "1995-06-11", "Software_Road_006", "1372222005");
		Customer c6 = new Customer(idIncrement++, "Jack", "female", "1995-08-03", "Software_Road_007", "1372222006");
		Customer c7 = new Customer(idIncrement++, "Zid", "female", "1995-06-015", "Software_Road_008", "1372222007");
		Customer c8 = new Customer(idIncrement++, "Carry", "female", "1995-11-07", "Software_Road_009", "1372222008");
		Customer c9 = new Customer(idIncrement++, "Osca", "male", "1995-06-23", "Software_Road_011", "1372222009");
		customers.add(c10);
		customers.add(c1);
		customers.add(c2);
		customers.add(c3);
		customers.add(c4);
		customers.add(c5);
		customers.add(c6);
		customers.add(c7);
		customers.add(c8);
		customers.add(c9);
	}
	
}
